import java.util.Scanner;
import java.lang.String;
import java.math.BigDecimal;
/**

 * Created by fengxingck on 2017/4/18.

 */
class Complex{
    public double shibu,xubu;
    public Complex(double shibu){
        this.shibu=shibu;
        this.xubu=0;
    }
    public Complex(double shibu,double xubu){
        this.shibu=shibu;
        this.xubu=xubu;
    }
    public double setshibu(double shibu){
        this.shibu=shibu;
        return this.shibu;
    }
    public double setxubu(double xubu){
        this.xubu=xubu;
        return this.xubu;
    }
    public void ComplexAdd(Complex a,Complex b){
        System.out.println("两个复数的和：");
        this.shibu=a.shibu+b.shibu;
        this.xubu=a.xubu+b.xubu;
    }
    public void ComplexSub(Complex a,Complex b){
        System.out.println("两个复数的差：");
        this.shibu=a.shibu-b.shibu;
        this.xubu=a.xubu-b.xubu;
    }
    public void ComplexMulti(Complex a,Complex b){
        System.out.println("两个复数的乘积：");
        this.shibu=a.shibu*b.shibu;
        this.xubu=a.xubu*b.xubu;
    }
    public void ComplexDiv(Complex a,Complex b){
        System.out.println("两个复数相除：");
        this.shibu=a.shibu/b.shibu;
        this.xubu=a.xubu/b.xubu;
    }
    public String toString(){
        String str=new String();
        if(this.xubu>0){
            str="(" + this.shibu + "+" + this.xubu + "i )";
        }
        else if(this.xubu<0)
        {  str="(" + this.shibu + "-" + this.xubu + "i )";}
        else  str="(" + this.shibu + ")";
        return str;
    }
    public boolean equals(Object a,Object b){
        if(a==b)
            return true;
        else return false;
    }
}
